<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Users</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='users.css') }}">

</head>
<body>
<div class="container">

    <h1>All Users</h1>
    <table>
        <thead>
        <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Age</th>
            <th>Actions</th>
        </tr>
        </thead>
        <tbody>
        {% for user in users %}
        <tr>
            <td>{{ user.id }}</td>
            <td>{{ user.name }}</td>
            <td>{{ user.age }}</td>
            <td>
                <a href="{{ url_for('main.edit_user', user_id=user.id) }}">Edit</a>


                <form action="{{ url_for('main.delete_user', user_id=user.id) }}" method="post" style="display:inline;">
                    <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                    <button type="submit">Delete</button>
                </form>
            </td>
        </tr>
        {% endfor %}
        </tbody>
    </table>
    <a class="add-button" href="{{ url_for('main.add_user') }}">Add New User</a>
</div>
</body>
</html>
